//
//  EXRequestClient.m
//  Edaox
//
//  Created by cao pan on 7/10/14.
//  Copyright (c) 2014 edaox. All rights reserved.
//

#import "EXRequestClient.h"
#import "EXHTTPAgent.h"
#import "EXRequestConfig.h"
#import "EXTestData.h"

@implementation EXRequestClient

+ (EXRequestClient *)sharedClient
{
    static EXRequestClient *sharedClient = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedClient = [[EXRequestClient alloc] init];
    });
    return sharedClient;
}

- (void)requestWithUri:(NSString *)apiUri responseBlock:(EXResponseBlock)responseBlock
{
    EXRequestMessage * requestMessage = [[EXRequestMessage alloc] init];
    [requestMessage setRequestPath:[NSString stringWithFormat:@"api/%@",apiUri]];
    [self startRequest:requestMessage responseBlock:responseBlock];
}


- (void)startRequest:(EXRequestMessage *)requestMessage responseBlock:(EXResponseBlock)responseBlock
{
    [requestMessage setString:kimonolabsKey  forKey:@"apikey"];
    [[EXHTTPAgent sharedAgent] requestAction:requestMessage responseMessage:responseBlock];
}



@end
